#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main() {
    int n;
    scanf("%d", &n);
    int a[19][19];
    int down = n;
    int right = 0;
    int count = 1;
    while (count <= n * n) {
        for (int i = right; i < down; i++)
            a[right][i] = count++;
        for (int i = right + 1; i < down; i++)
            a[i][down - 1] = count++;
        for (int i = down - 2; i >= right; i--)
            a[down - 1][i] = count++;
        for (int i = down - 2; i > right; i--)
            a[i][right] = count++;
        down--;
        right++;
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++)
            printf("%d ", a[i][j]);
        printf("\n");
    }
    return 0;
}